package com.huluobo.a2204monthdemo.category

import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.huluobo.a2204monthdemo.R
import com.huluobo.a2204monthdemo.databinding.FragmentCategoryBinding
import com.huluobo.base.view.BaseMVVMFragment

class CategoryFragment : BaseMVVMFragment<FragmentCategoryBinding, CategoryViewModel>() {
    override fun getLayoutId(): Int = R.layout.fragment_category

    override fun initData() {
        viewModel.getCategoryList()

        viewModel.categoryListSuccess.observe(this) {
            Log.i("TagA", "category:${it.data[0].data?.size}")
        }

        viewModel.categoryListFailed.observe(this) {
            Log.i("TagA", "获取分类失败:$it")
        }
    }

    override fun initView() {
    }

    override fun getViewModel(): Class<CategoryViewModel> {
        return CategoryViewModel::class.java
    }
}